﻿@model NewsItemListModel

@using Nop.Core.Domain.News

@{
    Layout = "_ColumnsTwo";

    //title
    NopHtml.AddTitleParts(T("PageTitle.NewsArchive").Text);
    //page class
    NopHtml.AppendPageCssClassParts("html-news-list-page");
}
<div class="page news-list-page">
    <div class="page-title">
        <a href="@Url.RouteUrl("NewsRSS", new { languageId = Model.WorkingLanguageId })" class="link-rss" title="@T("News.RSS.Hint")">@T("News.RSS")</a>
        <h1>@T("News")</h1>
    </div>
    <div class="page-body">
        @await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.NewsListPageBeforeItems, additionalData = Model })
        <div class="news-items">
            @foreach (var item in Model.NewsItems)
            {
                <div class="news-item">
                    <div class="news-head">
                        <a class="news-title" href="@(Url.RouteUrl<NewsItem>(new { SeName = item.SeName }))">@item.Title</a>
                        <span class="news-date">-@item.CreatedOn.ToString("D")</span>
                    </div>
                    <div class="news-body">
                        @Html.Raw(item.Short)
                    </div>
                    <div class="buttons">
                        <a href="@(Url.RouteUrl<NewsItem>(new { SeName = item.SeName }))" class="read-more">@T("News.MoreInfo")</a>
                    </div>
                    @await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.NewsListPageInsideItem, additionalData = item })
                </div>
            }
        </div>
        @{
            var pager = Html.Pager(Model.PagingFilteringContext).QueryParam("pagenumber");
        }
        @if (!(await pager.IsEmpty()))
        {
            <div class="pager">
                @pager
            </div>
        }
        @await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.NewsListPageAfterItems, additionalData = Model })
    </div>
</div>
